{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cb99a559",
   "metadata": {},
   "source": [
    "## api"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f7349c2f",
   "metadata": {},
   "source": [
    "## local"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "160c9aca",
   "metadata": {},
   "source": [
    "- `git clone` 下载 model weights\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c6df0ed0",
   "metadata": {},
   "source": [
    "### `from_pretrained`"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "26c57321",
   "metadata": {},
   "source": [
    "#### `cache_dir`"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bedaf9f1",
   "metadata": {},
   "source": [
    "- `cache_dir`：会自动下载，并将其缓存到该 `cache_dir` 内，而不是默认的 `HF_HOME`；\n",
    "    - 这样不用修改代码，第二次执行时，就直接在 cache_dir 内查找了\n",
    "\n",
    "```\n",
    "tokenizer = AutoTokenizer.from_pretrained('meta-llama/Llama-2-7b-chat-hf', cache_dir='./model')\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
